#ifndef CAMERA_H
#define CAMERA_H

#include <QVector3D>

class Camera
{
public:
    Camera();

    void setCameraSpeed(float cameraSpeed = 2.5f) { m_cameraSpeed = cameraSpeed; }
    void setMouseMoveSensitivity(float mouseMoveSensitivity = 0.1f) { m_mouseMoveSensitivity = mouseMoveSensitivity; }
    float fieldOfView() const { return m_fov; }

    QMatrix4x4 lookAt();
    QVector3D updatePosition();
    QVector3D front() const { return m_cameraFront; }
    QVector3D up() const { return m_cameraUp; }
    QVector3D pos() const { return m_cameraPos; }


    void onKeyPressed(int pressedKey);
    void onKeyReleased(int releasedKey);
    void onMouseMoved(const QPoint &offset);
    void onMouseWheelRotated(const QPoint &angleDelta);

private:
    static float currentFrame();

private:
    QVector3D m_cameraPos;
    QVector3D m_cameraFront;
    QVector3D m_cameraUp;

    float m_deltaTime;
    float m_lastFrame;

    int m_leftRight[2];
    int m_upDown[2];
    void pushDirectory(int array[2], int value);
    void popDirectory(int array[2], int value);

    float m_yaw;
    float m_pitch;
    float m_fov;

    float m_cameraSpeed;
    float m_mouseMoveSensitivity;
};

#endif // CAMERA_H
